﻿#ifndef VIDEOCALL_H
#define VIDEOCALL_H
#pragma once

#include <QWidget>
#include <QTcpSocket>
#include <QAudioInput>
#include <QAudioOutput>
#include <QAudioFormat>
#include <QAudioDeviceInfo>
#include "videocallthread.h"

namespace Ui {
class VideoCall;
}

class VideoCall : public QWidget
{
    Q_OBJECT

public:
    explicit VideoCall(QWidget *parent = nullptr,QString id="");
    ~VideoCall();
    void setLabelInfo(QString info);
    void sendSignalImgCall();
    QByteArray ImageToData(const QImage &image);
    QImage DataToImage(const QString &data);
private slots:
    void on_btn_stop_clicked();

    void on_btn_stop_2_clicked();

signals:
    void startImgCall();
    void stopImgCall();
private:
    Ui::VideoCall *ui;
    QTcpSocket* m_pTcpSock;         //传输声音
    QAudioDeviceInfo input_Device; //音频输入设备
    QAudioDeviceInfo output_Device; //音频输出设备
    QAudioInput *audioInput;
    QAudioOutput *audioOutput;
    QIODevice* input_stream;
    QIODevice* output_stream;
    QAudioFormat settings;  //音频设置

    QString id;             //记录id
    VideoCallThread* thread;
};

#endif // VIDEOCALL_H
